#ifndef SOCKET_ADDRESS_H_
#define SOCKET_ADDRESS_H_
#include <cstdint>
#include <string>
#include <netinet/in.h>
#include <vector>

class SocketAddress
{
public:
    static SocketAddress Address(const struct sockaddr_in& addr);
    static SocketAddress Address(const std::string & ip, uint16_t port);
    static SocketAddress Address(const std::string & key);
    static int           Address(const std::string & domain, uint16_t port, std::vector<SocketAddress> & address_vec);
    static int           Address(const std::string & domain, const std::string & protocol, std::vector<SocketAddress> & address_vec);
    static int           UdpAddress(const std::string & domain, uint16_t port, std::vector<SocketAddress> & address_vec);
public:
    SocketAddress();
    struct ::sockaddr_in NetAddress() const;
    std::string        AddressToString() const;
    uint16_t           PortToNumber() const;
    void               SockAddr(struct ::sockaddr_in & addr);
    void               PortNumber(uint16_t port);
    void               HostName(const std::string & host_name);
    std::string        HostName() const;
    std::string        AddressWithPortKey() const;
private:
    struct sockaddr_in m_sai{};
    std::string        m_host_name;
};


#endif
